package exceptionDemo2;

import java.util.Scanner;

public class UserManageTest {
	public static void main(String args[]) {
		UserManage userManage = new UserManage();
		Scanner scanner = new Scanner(System.in);
		while(true){
			try{
				System.out.println("1 注册  2 登录");
				String cmd = scanner.nextLine();
				if("1".equals(cmd)){
					System.out.println("email");
					String email = scanner.nextLine();
					System.out.println("pwd");
					String pwd= scanner.nextLine();
					User user=userManage.reg(email, pwd);
					System.out.println(user);
				}
				if("2".equals(cmd)){
					System.out.println("email");
					String email = scanner.nextLine();
					System.out.println("pwd");
					String pwd= scanner.nextLine();
					User user=userManage.login(email, pwd);
					System.out.println(user);
				}
			}catch(EmailExistException e){
				//e.printStackTrace();
				e.getMessage();
			}catch (PwdException e) {
				// TODO: handle exception
				e.printStackTrace();
			}
		}
	}
}
